<?php
require_once '../sub/init.php';
require_once 'chkUadm.php';
if(!is_mobile())header("Location: ./");
if ($session_kind=='crm'){
	header("Location: m_crm.php");
}
require_once ZEAI.'cache/config_shop.php';
require_once ZEAI.'cache/config_reg.php';$TG_set = json_decode(stripslashes($_REG['TG_set']),true);
if($submitok=='ajax_reg_day'){
	$rt=$db->query("SELECT COUNT(id) AS num,from_unixtime(regtime,'%Y-%m-%d') AS day FROM ".__TBL_USER__." WHERE kind<>4 GROUP BY day ORDER BY day DESC LIMIT 7");
	$total = $db->num_rows($rt);
	if ($total <= 0) {
		exit('');
	} else {
		while($tmprows = $db->fetch_array($rt,'name')){$arr[]=$tmprows;}
		$arrnew = array_reverse($arr);
		foreach ($arrnew as $rows) {
			$day = $rows['day'];
			$num = $rows['num'];
			$dayARR = explode('-',$day);
			$day = $dayARR[1].'-'.$dayARR[2];
			$arr[]=array("'".$day."'".",".$num);
		}
		exit(encode_json($arr));
	}
}
$row = $db->ROW(__TBL_CRM_HN__,"username,path_s,truename,title,agenttitle","flag=1 AND id=".$session_uid,"name");
if ($row){
	$username = $row['username'];
	$truename = trimhtml(dataIO($row['truename'],'out',7));
	$aboutus  = dataIO($row['aboutus'],'out');
	$title    = trimhtml(dataIO($row['title'],'out'));
	$agenttitle= dataIO($row['agenttitle'],'out');
	$agenttitle=(empty($agenttitle))?'总管':$agenttitle;
	$unum     = $row['unum'];
	$bbsnum   = $row['bbsnum'];
	$path_s   = $row['path_s'];
	$path_s_url = (!empty($path_s))?UP.$path_s:RES.'photo_m'.$sex.'.png';
	//$unum = $db->COUNT(__TBL_USER__,"admid=".$hid);
}else{
	zeaialert('{"title":"信息不存在","btnt":"我知道了","url":"-1"}');	
}
$nav='index';
?>
<!doctype html><html><head><meta charset="utf-8">
<title><?php echo $_ADM['admSiteName']; ?>《主后台》</title>
<?php echo HEADMETA; ?>
<script src="<?php echo RES;?>www_zeai_cn.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script src="<?php echo RES;?>m/js/m.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script src="js/highcharts.js"></script> 
<link href="<?php echo RES;?>m/css/m.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<link href="css/m_adm_index.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<style>
.hid_top,.m_box3 ul a i{background-color:<?php echo $_ADM['color'];?>}
.m_box3 ul a b,.m_box ul a b{color:<?php echo $_ADM['color'];?>}
</style>
</head>
<body class="body">
<?php localhost_auth();?>
<div class="top_btn">
    <a href="<?php echo HOST;?>/m/hongniang.php?hid=<?php echo $session_uid;?>"><img src="<?php echo $path_s_url;?>" class="logo"></a>
    <div class="hid">ID：<?php echo $session_uid;?></div>
    <a href="m_set.php" class="ico m_set">&#xe614;</a>
    <?php if($session_kind=='adm'){?><a href="m_crm.php" class="m_crm ico">红娘CRM</a><?php }?>
</div>
<div class="hid_top">
	<div class="truename ">
        <h3><?php echo $truename;?></h3>
        <span><?php echo $agenttitle;?></span>
        <div class="title ">角色：<?php echo $session_title;?></div>
        <div class="title ">帐号：<?php echo $username;?></div>
    </div>
</div>

<div class="m_box shbox">
    <h4>待办审核<a href="m_log.php" class="ico"><font class="C999">操作日志</font>&#xe601;</a></h4>
    <ul class="cols4">
        <a href="m_u_jb_list.php"><h6>资料</h6><b><?php 
        $rtt = $db->query("SELECT COUNT(*) FROM ".__TBL_USER__." U,".__TBL_SHALOU__." S WHERE U.id=S.uid AND (U.dataflag=0 OR S.photo_f=0) ");
        $rowt = $db->fetch_array($rtt);echo $rowt[0];?></b></a>

        <a href="m_photo_m.php"><h6>头像</h6><b id="F14"><?php echo $db->COUNT(__TBL_USER__,"photo_f=0 AND photo_s<>''");;?></b></a>

        <a href="m_photo.php?t=f0"><h6>相册</h6><b><?php
		$rtt = $db->query("SELECT COUNT(*) FROM ".__TBL_PHOTO__." a,".__TBL_USER__." b WHERE a.flag=0 AND a.uid=b.id");
		$rowt = $db->fetch_array($rtt);echo $rowt[0];?></b></a>
        
        <a href="m_video.php?t=f0"><h6>视频</h6><b><?php
		$rtt = $db->query("SELECT COUNT(*) FROM ".__TBL_VIDEO__." a,".__TBL_USER__." b WHERE a.flag=0 AND a.uid=b.id");
		$rowt = $db->fetch_array($rtt);echo $rowt[0];?></b></a>
        
        <a href="m_cert.php?f=f0"><h6>认证</h6><b><?php echo $db->COUNT(__TBL_RZ__,"flag=0");?></b></a>

        <a href="m_trend.php?f=f0"><h6>动态</h6><b><?php echo $db->COUNT(__TBL_TREND__,"kind=1 AND flag=0");?></b></a>
        
        <a href="m_trend_bbs.php?f=f0"><h6>动态评论</h6><b><?php echo $db->COUNT(__TBL_TREND_BBS__,"kind=1 AND flag=0");?></b></a>
        
        <a href="m_news_bbs.php?f=f0"><h6>文章评论</h6><b><?php echo $db->COUNT(__TBL_NEWS_BBS__,"flag=0");;?></b></a>
        
        <a href="m_TG_u.php?f=f0&k=2"><h6><?php echo $_SHOP['title'];?></h6><b id="F10"><?php echo $db->COUNT(__TBL_TG_USER__,"shopflag=0");?></b></a>
        
        <a href="m_TG_u.php?f=f0&k=1"><h6>推广红娘</h6><b><?php echo $db->COUNT(__TBL_TG_USER__,"flag=0");?></b></a>
        
        <a href="m_u_tg.php"><h6>推广提成</h6><b id="F11"><?php
		$t1=$db->COUNT(__TBL_USER__,"tgflag=0 AND tguid>0");
		$t2=$db->COUNT(__TBL_TG_USER__,"tgflag=0 AND tguid>0");
		echo $t1+$t2;?></b></a>
        
        <a href="m_withdraw.php"><h6>提现</h6><b id="F12"><?php echo $db->COUNT(__TBL_PAY__,"kind=-1 AND flag=0");;?></b></a>

        <a href="m_dating.php?f=f0"><h6>约会</h6><b id="F5"><?php echo $db->COUNT(__TBL_DATING__,"flag=0");;?></b></a>
        
        <a href="m_qun_trend.php?f=f0"><h6>群话题</h6><b id="F15"><?php
		$rtt = $db->query("SELECT COUNT(*) FROM ".__TBL_TREND__." a,".__TBL_USER__." b WHERE a.kind=2 AND a.flag=0 AND a.uid=b.id");
		$rowt = $db->fetch_array($rtt);echo $rowt[0];?></b></a>
        
        <a href="m_qun_bbs.php?f=f0"><h6>群评论</h6><b id="F16"><?php 
		$rtt = $db->query("SELECT COUNT(*) FROM ".__TBL_TREND_BBS__." a,".__TBL_USER__." b WHERE a.kind=2 AND a.flag=0 AND a.uid=b.id");
		$rowt = $db->fetch_array($rtt);echo $rowt[0];?></b></a>
        
        <a href="m_315.php?f=f0"><h6>举报</h6><b id="F13"><?php echo $db->COUNT(__TBL_315__,"flag=0");;?></b></a>
    </ul>
    <i class="ico off morebtn" onClick="morebtn(this);">&#xe60b;</i>
    <div class="clear"></div>
</div>
<div class="clear"></div>
<div class="m_box3">
    <h4>用户统计<a href="m_u.php" class="ico">&#xe601;</a></h4>
    <ul>
        <a href="m_u.php"><i class="ico">&#xe617;</i><h6>总数</h6><b><?php echo $db->COUNT(__TBL_USER__,"kind<>4");?></b></a>
        <a href="m_u.php?t=ext&sex=1"><i class="ico">&#xe637;</i><h6>男生</h6><b><?php echo $db->COUNT(__TBL_USER__,"sex=1 AND kind<>4");;?></b></a>
        <a href="m_u.php?t=ext&sex=2"><i class="ico">&#xe639;</i><h6>女生</h6><b><?php echo $db->COUNT(__TBL_USER__,"sex=2 AND kind<>4");;?></b></a>
    </ul>
    <br><br><br>
    <div id="container" style="width:95%;margin:0 auto;height:150px"></div>
    <div class="clear"></div>
</div>
<div class="clear"></div>
<?php if(in_array('welcome_pay',$QXARR)){?>
<div class="m_box">
    <h4>收益统计<a href="m_pay.php" class="ico">&#xe601;</a></h4>
    <ul class="cols4">
        <a href="m_pay.php?payflag=f1"><h6>总盈收(元)</h6><b id="F1"><?php $rt=$db->query("SELECT SUM(paymoney) AS paymoney FROM ".__TBL_PAY__." WHERE kind<>-1 AND flag=1");$row=$db->fetch_array($rt,'name');echo number_format($row['paymoney']);?></b></a>
        <a><h6>本月(元)</h6><b id="F2"><?php $rt=$db->query("SELECT SUM(paymoney) AS paymoney FROM ".__TBL_PAY__." WHERE kind<>-1 AND flag=1 AND (   date_format(from_unixtime(addtime),'%Y-%m') = date_format(now(),'%Y-%m')   )");$row=$db->fetch_array($rt,'name');echo number_format($row['paymoney']);
;?></b></a>
        <a><h6>今天(元)</h6><b id="F3"><?php 	$today = YmdHis(ADDTIME,'Ymd');$rt=$db->query("SELECT SUM(paymoney) AS paymoney FROM ".__TBL_PAY__." WHERE  kind<>-1 AND flag=1 AND ( date_format(from_unixtime(addtime),'%Y-%m-%d') = '$today'  )");$row=$db->fetch_array($rt,'name');echo number_format($row['paymoney']);
;?></b></a>
        <a><h6>今天(笔)</h6><b id="F4"><?php $rt=$db->query("SELECT COUNT(*) FROM ".__TBL_PAY__." WHERE kind<>-1 AND flag=1 AND ( date_format(from_unixtime(addtime),'%Y-%m-%d') = '$today'  )");$row=$db->fetch_array($rt,'num');echo $row[0];?></b></a>
        
    </ul>
    <div class="clear"></div>
</div>
<div class="clear"></div>
<?php }?>
<script>
	function reg(arr){
		Highcharts.chart('container', {
			chart: {type: 'column'},
			title: {text: '',style:{fontSize:'12px',color:'#999999',fontFamily:'sans-serif'}},
			subtitle: {text: ''},
			credits: {"enabled": false},
			xAxis: {
				type: 'category',
				labels: {
					rotation: -0,
					style: {fontSize: '10px',fontFamily: 'sans-serif'}
				}
			},
			yAxis: {min:0,title: {text:'最近 7天 用户注册量',style:{fontSize:'10px',color:'#999999',fontFamily:'sans-serif'}  }},//最近10天会员注册量
			legend: {enabled: false},
			tooltip: {pointFormat: '<b style="color:#666">注册{point.y:.0f}人</b>'},
			colors: ["rgba(<?php echo c16_rgb($_ADM['color']);?>,.5)"],
			series: [{
				name: 'zea.cn',
				data: arr,
				dataLabels: {
					enabled: true,
					rotation:0,
					color: '#ffffff',
					align: 'center',
					format: '{point.y:.0f}', // one decimal
					y:22, //10 pixels down from the top
					style:{fontSize:'10px',fontFamily:'sans-serif'}
				}
			}]
		});
	}
	setTimeout(function(){
		zeai.ajax({url:'m_adm'+zeai.ajxext+'submitok=ajax_reg_day'},function(e){
			if(!zeai.empty(e)){
				var arr=e;
				arr = arr.replace(/"/g,"");
				arr = zeai.jsoneval(arr);
				reg(arr);
			}
		});
	},200);
	function morebtn(btnobj){
		var H = btnobj.previousElementSibling.scrollHeight;
		if(btnobj.hasClass('off')){
			btnobj.removeClass('off');
			btnobj.addClass('on');
			btnobj.html('&#xe60a;');
			btnobj.previousElementSibling.style.height=H+'px';//auto
		}else{
			btnobj.removeClass('on');
			btnobj.addClass('off');
			btnobj.html('&#xe60b;');
			btnobj.previousElementSibling.style.height='110px';
		}
	}
</script>
<?php require_once 'm_btm.php';?>